Skip to content

[6.19.z] Fix errata contenthost - #20841

Merged
Satellite-QE merged 1 commit into
6.19.zfrom
cherry-pick-6.19.z-3653f9b8d375715c137532b9a6025697c304089b
Feb 23, 2026
Merged

[6.19.z] Fix errata contenthost#20841
Satellite-QE merged 1 commit into
6.19.zfrom
cherry-pick-6.19.z-3653f9b8d375715c137532b9a6025697c304089b

Conversation

@Satellite-QE

@Satellite-QE Satellite-QE commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator

Cherrypick of PR: #20825

Problem Statement

The legacy "Content host" page has been removed as part of SAT-37927 but some errata UI tests were left behind, trying to reach removed contenthost property, views and entities.

Solution

Use "All hosts page" instead where possible, remove what is "Content host" page related.

Related Issues

https://issues.redhat.com/browse/SAT-42273

PRT test Cases example

trigger: test-robottelo
pytest: tests/foreman/ui/test_errata.py -k 'content_host_errata_search_commands or apply_for_all_hosts or show_count_on_host_pages'

Summary by Sourcery

Update UI errata tests to align with the new All Hosts interface and current errata/task behavior, removing legacy Content Host dependencies.

Bug Fixes:

  • Adjust errata applicability and installation assertions to match the current task behavior and errata table schema in the new Hosts UI.

Tests:

  • Migrate errata-related UI tests from the removed legacy Content Host page to the All Hosts/Host details UI APIs.
  • Remove obsolete test coverage that depended on the legacy Content Host previous environment view.

* Fix test_content_host_errata_search_commands

* Fix test_positive_apply_for_all_hosts

* Remove test_positive_content_host_previous_env

* Fix test_positive_show_count_on_host_pages

* Address comments

(cherry picked from commit 3653f9b)
@Satellite-QE Satellite-QE added 6.19.z Auto_Cherry_Picked Automatically cherrypicked PR using GHA No-CherryPick PR doesnt need CherryPick to previous branches labels Feb 23, 2026
@Satellite-QE

Copy link
Copy Markdown
Collaborator Author
trigger: test-robottelo
pytest: tests/foreman/ui/test_errata.py -k content_host_errata_search_commands

@Satellite-QE Satellite-QE added the AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing label Feb 23, 2026
@sourcery-ai

sourcery-ai Bot commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Update errata UI tests to stop using the removed legacy Content Host page, switch them to the new Host/All Hosts UI, and relax/adjust assertions to match the new flows and data shapes, while removing one obsolete legacy-only test.

File-Level Changes

Change Details Files
Relax applicability task count assertion in bulk errata application test to avoid depending on legacy content host behavior.
  • Change assertion on applicability task count from an exact num_hosts+1 match to a >0 check to keep the test robust against backend/task pipeline changes
tests/foreman/ui/test_errata.py
Migrate per-host errata install and package verification flow from legacy Content Host UI APIs to the new Host UI APIs.
  • Replace session.contenthost.install_errata with Host UI navigation plus session.host_new.apply_erratas using an errata_id-based search filter
  • Add explicit polling for the Remote action: Install errata task via target_sat.wait_for_tasks and assert result == 'success'
  • Replace session.contenthost.search_package with session.host_new.get_packages and update expectations to validate Installed version derived from the package NVR
tests/foreman/ui/test_errata.py
Remove the legacy-only test that validated previous-environment errata visibility on the Content Host page.
  • Delete test_positive_content_host_previous_env and its associated content-host-previous-environment assertions and setup
  • Drop associated usage of session.contenthost.search_errata for the previous-environment dropdown
tests/foreman/ui/test_errata.py
Adjust the errata count visibility test to only validate the new Host Errata page and drop legacy Content Host expectations.
  • Update the test docstring and steps to describe only Hosts -> All Hosts navigation
  • Remove lookup of legacy contenthost search results and associated Installable Updates.errata count assertions
tests/foreman/ui/test_errata.py
Switch errata-related search and table assertions from legacy contenthost APIs to the new host_new APIs and align field names/values with the new UI.
  • Replace session.contenthost.search with session.host_new.search when searching for hosts by errata_status or applicable_errata/applicable_rpms
  • Replace session.contenthost.search_errata with session.host_new.get_errata_table using a search query on errata_id
  • Update table expectations from Id/Title/Type to the new Errata/Type/Synopsis columns and adjust expected type labels (e.g., 'Security' and 'Bugfix')
tests/foreman/ui/test_errata.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In test_positive_apply_for_all_hosts, changing the applicability task assertion from len(applicability_tasks) == num_hosts + 1 to > 0 makes the test much weaker; consider asserting a minimum relative to num_hosts (e.g. >= num_hosts) or otherwise tightening the expectation to preserve coverage while still avoiding dependence on the legacy extra task.
  • In test_positive_apply_for_all_hosts, session.host_new.search(client.hostname) is called without using the result; if this is only for navigation side effects, consider adding a short comment to clarify that, or refactor to a dedicated helper method to make the intent explicit.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_positive_apply_for_all_hosts`, changing the applicability task assertion from `len(applicability_tasks) == num_hosts + 1` to `> 0` makes the test much weaker; consider asserting a minimum relative to `num_hosts` (e.g. `>= num_hosts`) or otherwise tightening the expectation to preserve coverage while still avoiding dependence on the legacy extra task.
- In `test_positive_apply_for_all_hosts`, `session.host_new.search(client.hostname)` is called without using the result; if this is only for navigation side effects, consider adding a short comment to clarify that, or refactor to a dedicated helper method to make the intent explicit.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@vsedmik

vsedmik commented Feb 23, 2026

Copy link
Copy Markdown
Contributor
trigger: test-robottelo
pytest: tests/foreman/ui/test_errata.py -k 'content_host_errata_search_commands or apply_for_all_hosts or show_count_on_host_pages'

@Satellite-QE

Copy link
Copy Markdown
Collaborator Author

PRT Result

Build Number: 14418
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_errata.py -k content_host_errata_search_commands or apply_for_all_hosts or show_count_on_host_pages --external-logging
Test Result : ========= 5 passed, 24 deselected, 220 warnings in 2728.39s (0:45:28) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 23, 2026
@Satellite-QE
Satellite-QE merged commit 29bba76 into 6.19.z Feb 23, 2026
18 of 20 checks passed
@Satellite-QE
Satellite-QE deleted the cherry-pick-6.19.z-3653f9b8d375715c137532b9a6025697c304089b branch February 23, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.19.z Auto_Cherry_Picked Automatically cherrypicked PR using GHA AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants